package com.everyline.lib_common.service.wrap

import android.content.Context
import androidx.lifecycle.LiveData
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.template.IProvider
import com.alibaba.android.arouter.launcher.ARouter
import com.everyline.lib_common.bean.UserInfoBean
import com.everyline.lib_common.router.RouterPath
import com.everyline.lib_common.service.LoginService

/**
 * Created by on 2021/2/27.
 * 天天挂线
 *  746608431@qq.com
 *  描述:TODO
 */

object LoginServiceImplWrap {
    //service 这个需要赋值  lateinit是不会检查它为空
    @Autowired(name = RouterPath.Login.PATH_LOGIN2)
    lateinit var service: LoginService

    init {
        ARouter.getInstance().inject(this)
    }

    fun isLogin(): Boolean {
        return service.isLogin()
    }


    fun getUserInfo(): UserInfoBean? {
        return service.getUserInfo()
    }

    fun removeUserInfo() {
        service.removeUserInfo()
    }

    fun start(context: Context): LiveData<UserInfoBean> {
        return service.start(context)
    }


    fun getLiveData(): LiveData<UserInfoBean> {
        return service.getLiveData()
    }

}